import request from '../utils/request'

//获取活动优惠券
export const getAllCouponList = () => {
    return request({
        url: '/coupon/all',
        method: 'get'
    })
}


//根据优惠券状态查询用户优惠券列表
export const getCouponList = (params) => {
    return request({
        url: '/coupon/list',
        method: 'get',
        params: {
            status: params.status,
            page: params.page,
            pageSize: params.pageSize
        }
    })
}

//结算页面获取用户优惠券列表
export const getCouponListByUserId = () => {
    return request({
        url: '/coupon/checkoutCouponList',
        method: 'get',
    })
}
//获取当前商铺的可获取的优惠券
export const getShopCoupon = (shopId) => {
    return request({
        url: '/coupon/list/shop',
        method: 'get',
        params: {
            shopId
        }
    })
}

// 领取优惠券
export const receiveCouponApi = (couponId) => {
    return request({
        url: '/coupon/receive',
        method: 'post',
        params: {
            couponId
        }
    })
}
